<template>
	<view class="box">
		<u-empty    v-if="todaylist.length==0&&status!='loadmore'"   text="未来查询到账户明细"    icon="https://cdn.uviewui.com/uview/empty/history.png">
		</u-empty>
		<view v-else>
			<!-- <view style="margin-left: 20rpx;" class="fontweight">
				2022年10月
			</view> -->
			<view class="content3" >
				<view v-for="(item, index) in todaylist" >
					<u-row customStyle="margin-bottom: 10px">
						<u-col span="8">
							<view>
								
								<h4 >提现</h4>
							</view>
							<view class="demo-layout bg-purple-light">
								<span>{{utils.dateFormat(item.createTime)}}</span>
							</view>
						</u-col>
						<u-col span="4">
							<view class="right">
								<h4 >{{(item.withdrawalMoney/100).toFixed(2)}}</h4>
								
							</view>
							<view class="right">
								<span v-if="item.auditStatus!=2">{{switchs(item.auditStatus)}}</span>
								<span v-else style="color: red;">{{switchs(item.auditStatus)}}</span>
							</view>
						</u-col>
						
					</u-row>
					<u-divider lineColor="#b6b6b6"  :dashed="true"></u-divider>
				</view> 
				
			</view>
		</view>
		
		<u-loadmore :status="status" v-if="todaylist.length!=0"/>
	</view>
</template>

<script>
	import {
	    mapState 
	} from 'vuex';
	export default {
		data() {
			return {
				status: 'loadmore',//上滑加载函数
				noWithdrawal:0,//待提现金额
				
				pageVO:{
					pageNo: 1,
					pageSize: 20,
					technicianId:"", 
					//auditStatus: 1, // 默认只查询已审核 
					belongTo: 1,//后台默认查询直营店的技师提现
				},
				todaylist:[],
			}
		},
		computed: {
			//获取是否登录
			...mapState(['hasLogin','userInfo']) 
		},
		mounted() {
			this.showMoneyPage()
		},
		methods: {
			
			//查询今日入账记录
			showMoneyPage(){
				this.pageVO.technicianId=this.userInfo.id
				this.request.getRequest(this.http.httpsLian.getTechnicianWithdrawal,this.pageVO, true)
				.then(res => { 
					console.log("sss："+JSON.stringify(res.data.list))
					//this.todaylist=res.data.list
					if(res.code!=0 )return 
					if(res.data.list.length==0) {
					    this.status = 'nomore';
					    return
					}
					if(res.data.list.length<this.pageVO.pageSize) {
					    this.status = 'nomore';
					}
					if (this.pageVO.pageNo!= 1) {
						this.todaylist = this.todaylist.concat(res.data.list)
					} else {
						this.todaylist=res.data.list
					} 
				}).catch(res => {
					uni.$u.toast("网络异常15")
				})
			},
			//上拉事件触发
			onReachBottom(){
				console.log('上拉事件触发');
				this.pageVO.pageNo+=1
				this.status = 'loading';
				this.showMoneyPage()
			},
			// 页面下拉时触发，与 onLoad 等生命周期函数平级
			onPullDownRefresh() {
				console.log('页面下拉时触发');
				this.status = 'loadmore';
				//回复默认值
				this.list=[]
				this.pageVO.pageNo=1
				this.pageVO.pageSize=20
				this.showMoneyPage()
			    setTimeout(() => {
					// 操作完成时，必须结束下拉刷新，否则一直会有 loading 标志
					uni.stopPullDownRefresh();
				}, 1000);
			},
		    switchs(value){
				switch (value){
					case 0:
						return "待审核";
					case 1:
						return "已通过";
					case 2:
						return "未通过";
					case 3:
						return "已通过";
					
				}
			}
		}
	}
</script>
<style lang="scss" scoped>
.box{
	margin-top: 10rpx;
	//padding: 0px 10px;
}
page{
	background: #fff;
}
.content3{
	padding: 10px 0px;
	background-color: #fff;
	padding-right: 20px;
	.demo-layout {
		    border-radius: 4px;
		}
	view{
		margin-left: 10px;
	}		
	span{
		font-size: 12px;
		color:#909399;
	}
	.right{
		text-align: right
		
	}
}
.fontweight{
	font-weight: 550;
}
</style>
